<?php

namespace App\HttpController\Index;

use App\System\Http\AbstractInterface\Controller;
use App\Model\Setting\SettingModel;
use App\Middle\Index\IndexMiddle;

class Index extends Controller {
	public function index() {
		$seccess = function ($data, $message) {
			var_dump ( "seccess" );
			var_dump ( $data );
			var_dump ( $message );
		};
		$fail = function ($message, $code, $url) {
			var_dump ( "seccess" );
			var_dump ( $message );
			var_dump ( $code );
			var_dump ( $url );
		};
		(new IndexMiddle ())->meta ()->finished ( $seccess, $fail );
	}
	public function index2() {
		$this->response ()->withHeader ( 'Content-type', 'text/html; charset=utf8;' );
		$this->response ()->withHeader ( 'X-Powered-By', 'PHP/7.2.5' );
		echo "<pre>";
		var_dump ( "webhook 好用了 回家调试的" );
		echo "</pre>";
		$this->twig ()->assign ( "aaaa", "aaaa" );
		$this->twig ()->assign ( "navigation", [ 
				"aaaaa",
				"bbbbb",
				"ccccc" 
		] );
		$this->twig ()->assign ( "navigation2", (new SettingModel ())->getSettings () );
		$re = $this->twig ()->getTempLate ( "index" );
		$this->response ()->write ( $re );
	}
	protected function onRequest($action): ?bool {
		return true;
	}
	protected function afterAction($actionName): void {
	}
}